Skip to content

feat: JWT apiAuthentication UI integration #1096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

jescalada
Copy link
Contributor

Fixes #1091.

This PR adds a Settings page that allows configuring the JWT token to authenticate UI requests to the API:

image

Previously, requests were bypassing the JWT check if they came from an authenticated user, and being completely blocked when not logged in.

This PR also improves the error messages shown when JWT authentication fails:

Missing token

image

Bad JWT format

image

Expired JWT

image

Copy link

netlify bot commented Jul 9, 2025

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit 1e66bfb
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/687e12f0b580da0008e7e70f

Copy link

codecov bot commented Jul 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.42%. Comparing base (0e60143) to head (1e66bfb).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1096      +/-   ##
==========================================
+ Coverage   77.40%   77.42%   +0.02%     
==========================================
  Files          56       56              
  Lines        2288     2286       -2     
  Branches      258      258              
==========================================
- Hits         1771     1770       -1     
+ Misses        487      486       -1     
  Partials       30       30              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jescalada jescalada linked an issue Jul 9, 2025 that may be closed by this pull request
@JamieSlome
Copy link
Member

@jescalada - thanks for the PR ❤️

Perhaps it makes sense to display the error message outside of the table in a pop-up? Open until closed by the user?

@jescalada
Copy link
Contributor Author

I modified this so that it uses one of the predefined error components (and got the message out of the tabs box):

image

There's still an issue with a non-descriptive error when JWT is enabled but the config is missing.

@jescalada
Copy link
Contributor Author

jescalada commented Jul 10, 2025

I've tried to find better-looking error displays (such as custom-styled Snackbars, and other components), but it seems MUI v4 doesn't support some of the best ones.

In later versions of MUI we can use these Alert components or combine them with Snackbars to make it look better.

There's this issue for upgrading MUI to v5 #1023 which I'll take a look at soon. It might be worth modernizing the frontend a bit once the dependency upgrades are done. (Note: Upgrading directly to v7 is not possible as each new major version introduces various breaking changes - plus the automatic migration tools only go up one major version at a time)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement JWT API authorization support for UI Implement JWT API authorization support for UI
2 participants